#ifndef HUFFMANTREE_H
#define HUFFMANTREE_H

#include <queue>
#include <unordered_map>
#include <string>
#include "huffmanNode.h" // 包含HuffmanNode结构体的声明

// 用于比较HuffmanNode频率的比较函数对象
struct Compare {
    bool operator()(HuffmanNode* left, HuffmanNode* right) {
        return left->freq > right->freq;
    }
};

// Huffman树相关的函数声明

// 构建哈夫曼树
HuffmanNode* buildHuffmanTree(const std::unordered_map<std::string, int>& freqMap);

void freeHuffmanTree(HuffmanNode* root);

#endif // HUFFMANTREE_H